import * as actionTypes from './constants';

const defaultstate = {
    infodata: [],
    commontslist:[]
}

const reducer = (state = defaultstate, action) => {
   
    // console.log(action.data, '_+_+_+');
    // console.log(action,'action');
    switch (action.type) {
        case actionTypes.CHANGE_INFO:
            return {...state, infodata: action.data }
        case actionTypes.CHANGE_COMMONTSLIST:
            return {...state, commontslist:action.data}
        case actionTypes.CHANGE_GOODNUMBERDATA:
            console.log(action.data,'action.data');
            // console.log( action.data[0][action.data[1]].list1[action.data[2]].goodnumber,'9999');
            // let newnumber = action.data[0][action.data[1]].list1[action.data[2]].goodnumber
            // console.log(newnumber,'newnumber');
            // console.log(state.commontslist[action.data[1]].list1[action.data[2]].goodnumber,'state');
            // return {...state,state.commontslist[action.data[1]].list1[action.data[2]].goodnumber : newnumber+1}
            // return  state
            // console.log(commontslist,'commontslist');
            // console.log(state,'lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll');
            return {...state, commontslist:action.data}
        default:
            // console.log("###");
            return state;
            
    }
}

export default reducer;